//
//  ChooseCollectionViewCell.m
//  Cooking
//
//  Created by dlios on 15-10-10.
//  Copyright (c) 2015年 ZP.Y. All rights reserved.
//

#import "ChooseCollectionViewCell.h"
#import "SearchModel.h"
#import "UIImageView+WebCache.h"
@interface ChooseCollectionViewCell ()

@property(nonatomic ,retain)UIImageView *aimage;
@property(nonatomic ,retain)UILabel *nameLabel;

@end

@implementation ChooseCollectionViewCell
- (void)dealloc
{

    [_nameLabel release];
    [_aimage release];
    [super dealloc];
}


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creat];
    }
    return self;
}

-(void)creat
{
    self.aimage = [[UIImageView alloc]init];
    [self.contentView addSubview:_aimage];
    self.nameLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.nameLabel];
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    
    
    
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    self.aimage.frame = CGRectMake(10, 5, self.contentView.frame.size.width - 20, self.contentView.frame.size.height - 40);
    self.nameLabel.frame = CGRectMake(5, self.contentView.frame.size.height - 35, self.contentView.frame.size.width - 10, 30);
    self.nameLabel.font = [UIFont systemFontOfSize:15];
   

}

-(void)receveModel:(SearchModel *)model 
{
    [self.aimage sd_setImageWithURL:[NSURL URLWithString:model.image]placeholderImage:[UIImage imageNamed:@"zhanwei_01.png"]];
    self.nameLabel.text = model.title;
   }

@end
